import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/home.vue'
import Tabber from '../components/Tabbar/Tabbar.vue'
Vue.use(VueRouter)
const routes = [
    {
        path: '/',
        name: 'Home',
        components: {
            default: Home,
            tabbar: Tabber
        },
        meta: {
            keepAlive: true,
            showHeader:false
        }
    },
    {
        path: '/login',
        name: 'login',
        meta: {
            title:"登录",
            showHeader:false
        },
        component: () => import('../views/user/login/login.vue')
    },
    {
        name: 'order',
        path: '/order',
        components: {
            default: ()=>import('../views/order/order.vue'),
            tabbar:Tabber
        }
    },
    {
        name:'user',
        path:'/user',
        components: {
            default:()=>import('../views/user/user.vue'),
            tabbar:Tabber
        }
    },
    {
        name:'address',
        path:'/user/address',
        components: {
            default:()=>import('../views/user/user-address/user-address.vue')
        }
    },
    {
        name:'item-detail',
        path:'/item/detail/:spuId',
        components:{
            default:()=>import('../views/book/detail.vue')
        }
    },
    {
        name:'user-collect',
        path:'/user/collect',
        components:{
            default:()=>import('../views/user/user-collect/user-collect.vue')
        }
    },
    {
        name:'user-add-address',
        path:'/user/add/address',
        components:{
            default:()=>import('../views/user/user-address/user-add-address.vue')
        }
    },
    {
        name:'item-pmsSpu',
        path:'/spu/catalog3Id/:catalog3Id',
        components: {
            default:()=>import('../views/pmsProductInfo/pmsSpuList.vue')
        }
    },
    {
      name: 'bookList',
      path: "/bookListByCatalog2/catalog2Id=:catalog2Id/key =:key ",
      components: {
          default:()=>import('../views/book/bookList'),
      }
    },

    {
        name: 'category',
        path: '/category',
        components: {
            default:()=>import('../views/items/items'),
            tabbar: Tabber
        },
        meta: {
            keepAlive: true,
            showHeader:false
        }
    },
    {
        name:'sale_home',
        path: '/sale/home',
        components: {
            default:()=> import('../views/sale/home.vue'),
            tabbar: Tabber
        },
        meta: {
            keepAlive: true,
            showHeader:false
        }
    },
    {
        name: 'addBook',
        path: "/sale/add_new_book",
        components: {
            default:()=> import('../views/sale/addBook.vue')
        }
    },
    {
        name: "bookDetail",
        path: "/book/bookId=:bookId",
        components: {
            default:()=> import('../views/book/bookSale')
        }
    },
    {
      name: "bookUserSaleView",
      path: "/book/bookId=:bookId/userId=:userId",
      components: {
          default:()=>import('../views/book/bookUserSale')
      }
    },
    {
        name: "register",
        path: "/user/register",
        components: {
            default: () =>import("../views/user/login/register")
        }
    },
    {
        name: "forgetPassword",
        path: "/user/forgetPassword",
        components: {
            default: () => import("../views/user/login/forgetPassword")
        }
    },
    {
        name: "mySaleOrder",
        path: "/user/mySaleOrder",
        components: {
            default:()=> import("../views/order/mySaleOrder")
        }
    },
    {
        name: "userEdit",
        path: "/user/edit",
        components: {
            default: ()=> import("../views/user/userEdit")
        }
    },
    {
        name: "myBook",
        path: "/myBook",
        components: {
            default: ()=> import("../views/user/user-server/myBook")
        }
    }


]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
